<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('维度管理')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div id="tab-1" class="tab-pane active">
        <div class="panel-body">
            <table class="table table-bordered">
                <thead id="thead_data" >
                </thead>
                <tbody id="tbody_data" >
                </tbody>
            </table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "md/med/dim";
    $(function(){
        $.ajax({
            url:prefix+"/findDimData/[[${tableName}]]",
            cache: false,
            type: 'GET',
            dataType: 'json',
            success: function (data) {
                if(data.code=="0") {
                    var titles = data.data.fldList;
                    var bodyData = data.data.data;
                    var html="<tr><th width='20'></th>";
                    $.each(titles,function(index,item) {
                        html += '<th>'+item.idPubfld+'</th>';
                    });
                    $("#thead_data").html(html+"</tr>");
                    html="";
                    var value;
                    if(bodyData!=null) {
                        for(var i=0;i<bodyData.length;i++) {
                            html+="<tr><td>"+(i+1)+"</td>";
                            var trData = bodyData[i];
                            for(var j=0;j<titles.length;j++) {
                                value = trData[titles[j].idPubfld];
                                if(value==undefined) {
                                    value = "";
                                }
                                html+="<td>"+value+"</td>";
                            }
                            html+="</tr>";
                        }
                        $("#tbody_data").html(html);
                    }
                }
            }
        });
    });
</script>
</body>
</html>